﻿Public Class Layer

    Private Sub TemplateBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Validate()
        Me.TemplateBindingSource.EndEdit()
        Me.TableAdapterManager.UpdateAll(Me.DigitalDocumentDataSet)

    End Sub

    Private Sub TemplateAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DigitalDocumentDataSet.Layer' table. You can move, or remove it, as needed.
        Me.LayerTableAdapter.Fill(Me.DigitalDocumentDataSet.Layer)
        'TODO: This line of code loads data into the 'DigitalDocumentDataSet.Template' table. You can move, or remove it, as needed.
        Me.TemplateTableAdapter.Fill(Me.DigitalDocumentDataSet.Template)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd1.Click

        Me.LayerTableAdapter.Insert(TemplateIdTextBox.Text, PossitionXTextBox.Text, PossitionYTextBox.Text, DissmentionXTextBox.Text, DissmentionYTextBox.Text, ContextTextBox.Text, InnerLayerTextBox.Text, TypeCheckBox.Checked)

        Template.TemplateTableAdapter.Fill(Template.DigitalDocumentDataSet.Template)

        MsgBox("completed")

        For Each item As Control In Me.Controls

            If TypeOf item Is TextBox Then

                item.Text = String.Empty
            End If
        Next

        TemplateTableAdapter.Update(DigitalDocumentDataSet.Template)
        LayerTableAdapter.Update(DigitalDocumentDataSet.Layer)

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit1.Click
        Me.Close()

    End Sub
End Class